<template>
  <div class="container">
    <div class="screen" ref="screen">
      <div class="top">
        <Top></Top>
      </div>
      <div class="bottom">
        <div class="left">
          <Tourist class="tourist"></Tourist>
          <Sex class="sex"></Sex>
          <Age class="age"></Age>
        </div>
        <div class="center">
          <Map class="map"></Map>
          <Line class="line"></Line>
        </div>
        <div class="right">
          <Rank class="rank"></Rank>
          <Year class="year"></Year>
          <Count class="count"></Count>
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts"  setup>
import { ref, onMounted } from "vue";
import {} from "vue-router";
import Top from "./components/top/index.vue";
import Tourist from "./components/Tourist/index.vue";
import Sex from "./components/Sex/index.vue";
import Age from "./components/Age/index.vue";
import Map from "./components/Map/index.vue";
import Line from "./components/line/index.vue";
import Year from "./components/Year/index.vue";
import Rank from "./components/Rank/index.vue";
import Count from "./components/Count/index.vue";
let screen = ref();
console.log(screen, "绑定了这个dom了吗");
onMounted(() => {
  console.log("进来了没");

  screen.value.style.transform = `scale(${getScale()}) translate(-50%,-50%)`;
});
//定义大屏缩放比例
function getScale(w = 1920, h = 1080) {
  const ww = window.innerWidth / w;
  const wh = window.innerHeight / h;
  return ww < wh ? ww : wh;
}
//监听视口变化
window.onresize = () => {
  screen.value.style.transform = `scale(${getScale()}) translate(-50%,-50%)`;
};
</script>

<style lang="scss" scoped>
.container {
  width: 100vw;
  height: 100vh;
  background: url(./images/bg.png) no-repeat;
  background-size: cover;
  padding: 0 50px 0;
  .screen {
    position: fixed;
    width: 1920px;
    height: 1080px;
    // background-color: aquamarine;
    left: 50%;
    top: 50%;
    transform-origin: left top;
    .top {
      width: 100%;
      height: 40px;
    }
    .bottom {
      display: flex;
      .left {
        flex: 1;
        height: 1040px;
        display: flex;
        flex-direction: column;
        .tourist {
          flex: 1.2;
        }
        .sex {
          flex: 1;
        }

        .age {
          flex: 1;
        }
      }
      .center {
        flex: 1.5;
        display: flex;
        flex-direction: column;
        .map {
          flex: 3;
        }

        .line {
          flex: 1;
        }
      }
      .right {
        flex: 1;
        // background-color: aquamarine;
        display: flex;
        flex-direction: column;
        margin-left: 40px;
        .rank {
          flex: 1.5;
        }

        .year {
          flex: 1;
        }

        .count {
          flex: 1;
        }
      }
    }
  }
}
</style>